package com.neusoft.yiyang.customer.client;

import com.neusoft.yiyang.common.entity.bed.Bed;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "bed-service")
public interface BedClient {

    // 床位分配接口
    @PostMapping("/beds/{customerId}/assign-bed/{bedId}")
    void assignBedToCustomer(
            @PathVariable("customerId") Integer customerId,
            @PathVariable("bedId") Integer bedId
    );

    // 床位调换接口
    @PostMapping("/beds/{customerId}/swap-bed/{oldBedId}/{newBedId}")
    void swapBedForCustomer(
            @PathVariable("customerId") Integer customerId,
            @PathVariable("oldBedId") Integer oldBedId,
            @PathVariable("newBedId") Integer newBedId
    );

    // 床位查询接口
    @GetMapping("/beds/getByBedIds")
    List<Bed> getByBedIds(@RequestParam List<Integer> bedIds);

    //查询BedId接口
    @GetMapping("/beds/query")
    Integer getBedIdByLocation(
            @RequestParam("buildingNo") Integer buildingNo,
            @RequestParam("floor") Integer floor,
            @RequestParam("roomNumber") String roomNumber,
            @RequestParam("bedNo") Integer bedNo
    );

    // 根据ID查询床位信息
    @GetMapping("/beds/{id}")
    Bed getBed(@PathVariable Integer id);

    //更新床位信息
    @PutMapping("/beds/update")
    void updateBed(@RequestBody Bed bed);

    @GetMapping("/beds/all")
    List<Bed> getAllBeds();

    @GetMapping("/beds/getAllFreeBeds")
    List<Bed> getAllFreeBeds();
}